package com.tywj.test.lib.kotlin

class CloneTest1 {


    fun main(args: Array<String>) {
        val student = Student()
        student.age = 24
        student.name = "niesong"
        val student2 = student.clone() as Student
        //这个是调用下面的那个方法，然后把这个这个对象Clone到student
        println("Age:" + student2.age + " " + "Name:" + student2.name)
        println("---------------------")
        student2.age = 23
        //克隆后得到的是一个新的对象，所以重新写的是student2这个对象的值
        println(student.age)
        println(student2.age)
    }
}